//
//  UIButton+Extention.swift
//  SinaBlog
//
//  Created by macs on 15/11/13.
//  Copyright © 2015年 BlackTail. All rights reserved.
//

import UIKit

extension UIButton {

    
    convenience init(title : String? , color : UIColor?, icon: String?,image : String = "",size : CGFloat = 14){
        self.init()
        
        setTitle(title, forState:  .Normal)
        setTitleColor(color, forState: .Normal)
        
        if icon != nil {
            setBackgroundImage(UIImage(named:icon!), forState: .Normal)
            setBackgroundImage(UIImage(named:icon! + "_highlighted"), forState: .Highlighted)
        }
        
        setImage(UIImage(named: image), forState: .Normal)
        titleLabel?.font = UIFont.systemFontOfSize(size)
    }
    
    
}